Map

Data

Source: National Interagency Fire Center ArcGIS Online Site
Last Update: 2020-10-31 01:07:58 PST

About

The US Wildfire Dashboard

The US Wildfire Dashboard provides a live update for the ongoing wildfire in the US. This dashboard is built with R using Rmakrdown and flexdashboard framework, and can easily reproduce by others. The code behind the dashboard available here

Data

The input data for this dashboard is the National Interagency Fire Center ArcGIS Online Site.

Data on the dashboard is refreshed hourly with Github Actions, where the raw data on the NIFC website is getting updated every few hours.

Packages

Deployment and reproducibly

The dashboard was deployed to Github docs. If you wish to deploy and/or modify the dashboard on your Github account, you can apply the following steps:

The supporting docker with the required packages for running this dashboard is available here. To run the dashboard locally with RStudio follow the following steps:

docker run -p 8787:8787 -e PASSWORD='Your_Password' -e USER='Your_Username' -v ~/your_local_path  rkrispin/us_wildfire_rstudio:dev

Where the Your Password and Your Username above should replace with the password and username you wish to set for the RStudio instance. The your_local_path argument should replace with the local path of the cloned dashboard on your machine. Once the docker is lunched, use on your browser http://localhost:8787 for login RStudio (using the credential you set above) and access the dashboard on sub-folder uswildfire and render the index.Rmd file to lunch the dashboard.

For any question or feedback, you can either open an issue or contact me on Twitter.

---
title: "US Wildfire Dashboard"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    social: menu
    source_code: embed
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)

bar_chart <- function(label, width = "100%", height = "14px", fill = "#00bfc4", background = NULL) {
  bar <- htmltools::div(style = list(background = fill, width = width, height = height))
  chart <- htmltools::div(style = list(flexGrow = 1, marginLeft = "6px", background = background), bar)
  htmltools::div(style = list(display = "flex", alignItems = "center"), label, chart)
}

`%>%` <- magrittr::`%>%`
load("./data/us_wildfire_map.RData")
load("./data/us_wildfire_poly.RData")

df <- poly %>% dplyr::select(object_id = OBJECTID, incident_name = IncidentName,
                             IMT_name = IMTName, unit_id = UnitID,
                             map_method = MapMethod, comments = Comments,
                             gis_acres = GISAcres, shape_area = Shape__Area, global_id_2 = GlobalID_2) %>%
  dplyr::distinct()
```

Map
===================================== 

```{r map}
m
```

Data
===================================== 
```{r table}


table <- reactable::reactable(data = df, 
                              pagination = FALSE,
                              highlight = TRUE,
                              height = 1200,
                              defaultSorted = "gis_acres",
                              sortable = TRUE,
                              borderless = TRUE,
                              defaultPageSize = nrow(df),
                              columns = list(
                                object_id = reactable::colDef(name = "Object ID"),
                                incident_name = reactable::colDef(name = "Incident Name"),
                                IMT_name = reactable::colDef(name = "IMT Name"),
                                unit_id = reactable::colDef(name = "Unit ID"),
                                map_method = reactable::colDef(name = "Map Method"),
                                comments = reactable::colDef(name = "Comments"),
                                gis_acres = reactable::colDef(name = "GIS Acres",
                                                              sortable = TRUE,
                                                              defaultSortOrder = "desc",
                                                              # format = reactable::colFormat(separators = TRUE, digits = 0),
                                                              cell = function(value) {
                                                                width <- paste0(value * 100 / max(df$gis_acres), "%")
                                                                # Add thousands separators
                                                                value <- format(value, big.mark = ",")
                                                                bar_chart(value, width = width, fill = "red")
                                                              },
                                                              align = "left"),
                                shape_area = reactable::colDef(name = "Shape Area",
                                                               format = reactable::colFormat(separators = TRUE, digits = 5)),
                                global_id_2 = reactable::colDef(name = "Global ID")
                                
                              ))


htmltools::div(class = "us-wildfire",
               htmltools::div(class = "us-wildfire-header",
                              htmltools::div(class = "us-wildfires-title", "Source: National Interagency Fire Center ArcGIS Online Site"),
                              
                              paste("Last Update: ", run_time, " PST", sep = "")
               ),
               table
)

```

About
===================================== 


**The US Wildfire Dashboard**

The US Wildfire Dashboard provides a live update for the ongoing wildfire in the US. This dashboard is built with R using [Rmakrdown](https://rmarkdown.rstudio.com/) and [flexdashboard](https://rmarkdown.rstudio.com/flexdashboard/) framework, and can easily reproduce by others. The code behind the dashboard available [here](https://github.com/RamiKrispin/uswildfire)




**Data**

The input data for this dashboard is the [National Interagency Fire Center ArcGIS Online Site](https://data-nifc.opendata.arcgis.com/).

Data on the dashboard is refreshed hourly with [Github Actions](https://github.com/RamiKrispin/uswildfire/blob/master/.github/workflows/data_refresh.yml), where the raw data on the NIFC website is getting updated every few hours.


**Packages**

* Dashboard interface - the [flexdashboard](https://rmarkdown.rstudio.com/flexdashboard/) package. 
* Mapping - [leaflet](https://rstudio.github.io/leaflet/) for plotting the map and [sf](https://r-spatial.github.io/sf/index.html) packages
* Data - [jsonlite](https://github.com/jeroen/jsonlite) for parsing the raw data
* Tables - the [reactable](https://glin.github.io/reactable/) and [htmltools](https://github.com/rstudio/htmltools) packages

**Deployment and reproducibly**

The dashboard was deployed to Github docs. If you wish to deploy and/or modify the dashboard on your Github account, you can apply the following steps:

* Fork the dashboard [repository](https://github.com/RamiKrispin/uswildfire), or
* Clone it and push it to your Github package
* Here some general guidance about deployment of flexdashboard on Github page - [link](https://github.com/pbatey/flexdashboard-example)


The supporting docker with the required packages for running this dashboard is available [here](https://hub.docker.com/repository/docker/rkrispin/us_wildfire). To run the dashboard locally with RStudio follow the following steps:

* Clone the dashboard [repository](https://github.com/RamiKrispin/uswildfire)
* Run the following docker:

``` bash
docker run -p 8787:8787 -e PASSWORD='Your_Password' -e USER='Your_Username' -v ~/your_local_path  rkrispin/us_wildfire_rstudio:dev
```

Where the `Your Password` and `Your Username` above should replace with the password and username you wish to set for the RStudio instance. The `your_local_path` argument should replace with the local path of the cloned dashboard on your machine. Once the docker is lunched, use on your browser `http://localhost:8787` for login RStudio (using the credential you set above) and access the dashboard on sub-folder `uswildfire` and render the `index.Rmd` file to lunch the dashboard.


For any question or feedback, you can either open an [issue](https://github.com/RamiKrispin/uswildfire/issues) or contact me on [Twitter](https://twitter.com/Rami_Krispin).